package org.example.musicserver.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.example.musicserver.common.Result;
import org.example.musicserver.entity.MV;
import org.example.musicserver.service.MVService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/mv")
@Tag(name = "MV相关接口")
public class MVController {

    @Resource
    private MVService mvService;

    @PostMapping("/add")
    @Operation(summary = "mv添加")
    public Result addMV(@RequestBody MV mv) {
        return mvService.addMV(mv);
    }

    @DeleteMapping("/delete")
    @Operation(summary = "mv删除")
    public Result deleteMV(@RequestParam Integer mvId) {
        return mvService.deleteMV(mvId);
    }

    @PostMapping("/update")
    @Operation(summary = "mv修改")
    public Result updateMV(@RequestBody MV mv) {
        return mvService.updateMV(mv);
    }

    @GetMapping("/select")
    @Operation(summary = "mv列表查询")
    public Result selectMV(@RequestParam String query,@RequestParam(required = false) Integer singId){
        return mvService.selectMV(query,singId);
    }
    @GetMapping("/detail")
    @Operation(summary = "mv查询")
    public Result detail(@RequestParam Integer id){
        return mvService.detail(id);
    }

    @PostMapping("/upload")
    @Operation(summary = "文件上传")
    public Result uploadMV(@RequestParam MultipartFile file,@RequestParam String type){
        return mvService.uploadMV(file,type);
    }
}
